<template>
    <div class="auth">
        <div class="navbar-left">
            <div class="form-group input-group-lg">
                <input type="text" v-model="state.username" class="form-control" placeholder="用户名">
            </div>
            <div class="input-group form-group input-group-lg">
                <input type="password" v-model="state.password" class="form-control" placeholder="密码">
            </div>
            <button type="button" class="btn btn-success btn-lg submit-btn" @click="submit">注册</button>
        </div>
    </div>
</template>
<script setup>
import {
    RegisterUser
} from '../../api/user.js'


import {
    GetCaptcha
} from '../../api/common.js'
import {
    ref,
    reactive,
    onBeforeMount
} from 'vue'

import {useRouter} from 'vue-router'
const router = useRouter()

const state = reactive({
    username: ref(''),
    password: ref('')
})
const submit = () => {
    RegisterUser({
            username: state.username,
            password: state.password
        })
        .then(({
            code,
            data,
            msg
        }) => {
            if (code == 200) {
                console.log(msg)
				router.push('/login');
            }
        })
}
</script>